package model

import (
	"service/basic/config"
	"time"
)

type Record struct {
	Id        uint      `gorm:"column:id;type:int UNSIGNED;primaryKey;not null;" json:"id"`
	UserId    uint      `gorm:"column:user_id;type:int UNSIGNED;comment:用户id;not null;" json:"user_id"`                                     // 用户id
	DocerId   uint      `gorm:"column:docer_id;type:int UNSIGNED;comment:医生id;not null;" json:"docer_id"`                                   // 医生id
	CreatedAt time.Time `gorm:"column:created_at;type:datetime(3);comment:看诊时间;not null;default:CURRENT_TIMESTAMP(3);" json:"created_at"` // 看诊时间
}

func (re *Record) TableName() string {
	return "record"
}

// 添加问诊记录
func (r *Record) Create() error {
	return config.DB.Create(&r).Error
}
